package com.lykj.llw.box.adapter.sale

import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lykj.lib_base.component.GlideApp
import com.lykj.llw.box.R
import com.lykj.llw.box.data.bean.response.RoleBuyListResponse

/**
 * ================================================
 * 角色购买适配器(账号交易)
 * ================================================
 *
 * @author gosha
 * @date 2023/10/20-16:06
 */
class RoleBuyAdapter :
    BaseQuickAdapter<RoleBuyListResponse.DataDTO.RowsDTO, BaseViewHolder>(R.layout.item_role_buy) {
    override fun convert(holder: BaseViewHolder, item: RoleBuyListResponse.DataDTO.RowsDTO) {
        holder.setText(R.id.tv_role_name, "${item.rolename}")
        holder.setText(R.id.tv_game_name, "${item.gameName}")

        GlideApp.with(context)
            .load(item.gameIcon)
            .transition(DrawableTransitionOptions.withCrossFade())
            .into(holder.getView(R.id.iv_icon))

        holder.setText(R.id.tv_money, "${item.money}")
//        holder.setText(R.id.tv_create_days, "XX")
        holder.setText(
            R.id.tv_custom_amount,
            "${if (item.payMoney == null) "0" else item.payMoney}"
        )
    }
}